<?php
/*
*	广告
*/
class Ad{
	
	/*
	* 获取广告位（JS）
	*/
	public function getJsAd($adcode){
		$res = M("Advertise")->where('adcode = "'.$adcode.'" ')->find();
		$value =$res['adcontent'];
		echo str_replace("\r\n","",$value);	
	}
	
	/*
	* 获取幻灯片(JS)	
	*/
	public function getJsHd($cid){
		//$res = MCache::get('Ad/'.$cid);	
		$res = M('ad')->where('cid='.$cid)->order('sorts desc')->select();
		$value = "<ul>";
		foreach($res as $v){
			$value .= '<li><a href="'.$v["url"].'" target="_blank" title="'.$v["adname"].'"><img width="1024" height="300" src="'.getMyUrl('liuxue').$v["adpic"].'" alt="" /></a></li>';
		}
		$value .= "</ul>";
		echo str_replace("\r\n","",$value);
	}
		
}